<template>
	<view class="container">
		<view class="item">
			<u-swiper
				:list="info.imagesUrl"
				mode="round" 
				indicator-pos="bottomRight" 
				height="380"
				border-radius="0"
			></u-swiper>
			<!-- <image src="../../static/p3.jpg" mode=""></image> -->
			<view class="item_txt">
				<text>{{ info.title }}</text>
				<text class="des">{{ info.description }}</text>
			</view>
		</view>
		<view class="news">
			<view class="news_header">
				<text>详情</text>
			</view>
			<view class="news_body">
				<u-parse :html="info.content" :tag-style="style" :show-with-animation="true"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	import { dietDetail } from '../../api/api'
	export default {
		data() {
			return {
				form: {
					name: '',
					phone: '',
					remark: ''
				},
				info: {},
				style: {
					image: 'max-width: 100%;',
					p: 'text-indent: 0'
				}
			};
		},
		onLoad(options) {
			this.getDetail(options.id)
		},
		methods: {
			getDetail(id) {
				dietDetail({ id }).then(res => {
					if(res.code == 1) {
						this.info = res.data
					} else {
						this.$u.toast(res.msg)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #e8e8e8;
	}
	
	.item {
		display: flex;
		flex-direction: column;
		background-color: #fff;
		border-radius: 8rpx;
		overflow: hidden;
		margin-bottom: 25rpx;

		image {
			width: 100%;
			height: 380rpx;
		}

		.item_txt {
			display: flex;
			flex-direction: column;
			padding: 20rpx;

			text {
				display: block;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				font-size: 32rpx;
			}

			.des {
				color: #888;
				font-size: 28rpx;
				margin-top: 10rpx;
			}
		}
	}
	.news {
		width: 100%;
		background-color: #fff;
		margin-top: 15rpx;
		
		.news_header {
			display: flex;
			align-items: center;
			justify-content: space-between;
			width: 100%;
			padding: 30rpx 25rpx;
			border-bottom: 1px solid #eee;
			text {
				position: relative;
				font-size: 32rpx;
				font-weight: 700;
				padding-left: 30rpx;
				&::before {
					content: '';
					position: absolute;
					top: 0;
					left: 0;
					width: 8rpx;
					height: 100%;
					border-radius: 4rpx;
					background-color: #4CD964;
				}
			}
		}
		.news_body {
			width: 100%;
			padding: 25rpx;
			text-align: justify;
		}
	}
</style>
